﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Configuration;
using System.IO;
using System.Drawing.Imaging;
using System.Net;
using CarLoanSystem.Web.Comman;
using CarLoanSystem.DAL;
using CarLoanSystem.Entity;

namespace CarLoanSystemWeb.Page.CarInfo
{
    public partial class wuc_view_car : UserControlManageForm
    {
        private static CarInfoItem carInfoItem;
        protected void Page_Load(object sender, EventArgs e)
        {
            
            if (!IsPostBack)
            {
                carInfoItem = CarInfoDAL.LoadCar(Convert.ToInt32(this.Request.QueryString["id"].ToString()));
                this.txtBrandName.Text = carInfoItem.CAR_BRAND_NAME;
                this.txtCarDetail.Text = carInfoItem.CAR_DETAIL;
                this.txtModelName.Text = carInfoItem.CAR_MODEL_NAME;
                this.txtPrice.Text = carInfoItem.CAR_PRICE.ToString();
                this.txtTypeEngine.Text = carInfoItem.CAR_TYPE_ENGINE;
                string path = carInfoItem.CAR_PATH_IMAGE;

                if (path != "")
                {
                    string[] pathArr = path.Split('\\');
                    this.Image1.ImageUrl = Page.ResolveUrl("~/" + pathArr[9].ToString() + "/" + pathArr[10].ToString() + "/" +
                        pathArr[11].ToString() + "/" + pathArr[12].ToString() + "/" + pathArr[13].ToString());
                    this.Image1.DataBind();
                }
            }
        }
    }
}